#!/bin/bash

# 当前目录下执行
# sh ./build.sh

# 删除gen目录，在创建gen目录，达到清空效果
rm -rf ../gen
mkdir "../gen"

# health
protoc -I ../third_party -I ./ --grpc-gateway_out=../gen --grpc-gateway_opt logtostderr=true --grpc-gateway_opt paths=source_relative --go_out=../gen --go_opt paths=source_relative --go-grpc_out=../gen --go-grpc_opt paths=source_relative ./health/*.proto

# user
protoc -I ../third_party -I ./ --grpc-gateway_out=../gen --grpc-gateway_opt logtostderr=true --grpc-gateway_opt paths=source_relative --go_out=../gen --go_opt paths=source_relative --go-grpc_out=../gen --go-grpc_opt paths=source_relative ./user/*.proto
protoc -I ../third_party -I ./ --govalidators_out=../gen ./user/*.proto

# goods
protoc -I ../third_party -I ./ --grpc-gateway_out=../gen --grpc-gateway_opt logtostderr=true --grpc-gateway_opt paths=source_relative --go_out=../gen --go_opt paths=source_relative --go-grpc_out=../gen --go-grpc_opt paths=source_relative ./goods/*.proto
protoc -I ../third_party -I ./ --govalidators_out=../gen ./goods/*.proto